inspector: Add a way to highlight widgets
authorMatthias Clasen <mclasen@redhat.com>
Wed, 21 May 2014 01:43:00 +0000 (21:43 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 21 May 2014 01:43:00 +0000 (21:43 -0400)
In contrast to the flashing, where we blink the widget a
few times, this is explicitly turned on and off.

It will be used for indicating widgets that are part of
a size group, in the next commit.

gtk/inspector/inspect-button.c
gtk/inspector/window.h

index fe438ffc5cdf61b090a3a2c3ca930df0e7b2c1bd..c4553967b2432283daceff7f08ad13e58684990e 100644 (file)
@@ -299,7 +299,7 @@ draw_flash (GtkWidget          *widget,
 {
   GtkAllocation alloc;
 
-  if (iw->flash_count % 2 == 0)
+  if (iw && iw->flash_count % 2 == 0)
     return FALSE;
 
   if (GTK_IS_WINDOW (widget))
@@ -359,4 +359,18 @@ gtk_inspector_flash_widget (GtkInspectorWindow *iw,
   iw->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, iw);
 }
 
+void
+gtk_inspector_start_highlight (GtkWidget *widget)
+{
+  g_signal_connect_after (widget, "draw", G_CALLBACK (draw_flash), NULL);
+  gtk_widget_queue_draw (widget);
+}
+
+void
+gtk_inspector_stop_highlight (GtkWidget *widget)
+{
+  g_signal_handlers_disconnect_by_func (widget, draw_flash, NULL);
+  gtk_widget_queue_draw (widget);
+}
+
 /* vim: set et sw=2 ts=2: */
index 2621f26a1aa601189fb129512c528042c7d90ca4..1349f9590efcf5ea8b513c06e58aa600e7e91b21 100644 (file)
@@ -50,6 +50,7 @@ typedef struct
   GtkWidget *classes_list;
   GtkWidget *widget_css_editor;
   GtkWidget *object_hierarchy;
+  GtkWidget *size_groups;
   GtkWidget *data_list;
   GtkWidget *actions;
 
@@ -75,7 +76,10 @@ GType      gtk_inspector_window_get_type    (void);
 GtkWidget *gtk_inspector_window_new         (void);
 
 void       gtk_inspector_flash_widget       (GtkInspectorWindow *iw,
-                                             GtkWidget      *widget);
+                                             GtkWidget          *widget);
+void       gtk_inspector_start_highlight    (GtkWidget          *widget);
+void       gtk_inspector_stop_highlight     (GtkWidget          *widget);
+                                            
 
 G_END_DECLS